package com.chouren.goandroid.animate;

import com.chouren.goandroid.animate.effect.EffectType;
import com.chouren.goandroid.util.Logger;

import android.view.View;
import android.view.ViewGroup;

/**
 * 执行动画,可以对view或viewgroup执行动画
 * @author TangLong
 * @date 2014年8月14日
 */
public class AnimationEffector {
	private static int delayInterval = 200;
	
	public static void run(View view, EffectType effectType, long duration, long startDelay) {
		effectType.getEffectAnimator().setDuration(duration).setStartDelay(startDelay).start(view);
	}
	
	public static void runChildren(ViewGroup viewGroup, EffectType effectType, long duration) {
		if(viewGroup != null) {
			Logger.debug(null, viewGroup.getChildCount() + "");
			for(int i = 0; i < viewGroup.getChildCount(); i++) {
				View view = viewGroup.getChildAt(i);
				run(view, effectType, duration, delayInterval * i);
			}
		}
	}
	
}
